const Compiler = require("./Compiler.js");

module.exports = function webpack(webpackOptions) {
    // 1.收集参数，构建Compiler对象
    let compiler = new Compiler(webpackOptions);
    // 2.挂载插件
    webpackOptions.plugins.forEach(plugin => {
        plugin.apply(compiler);
    });
    return compiler;
}